import sys
import urllib.request
import os

coreversion = input('please input core version:')
mversion = input('please input mobile version:')
pcversion = input('please input pc version:')
fileversion = input('please input fileserver version:')

if coreversion != "":
    print("downloading YX_Core-"+coreversion+" with urllib.request")
    url = 'http://10.0.0.110:8110/nexus/service/local/repositories/YX-release/content/com/yxht/core/YX_Core/'+coreversion+'/YX_Core-'+coreversion+'.war'
    try:
        r = urllib.request.urlopen(url).read()
        with open("YX_Core.war", "wb") as code:
            code.write(r)
        print('downloading YX_Core-' + coreversion + '.war finished!')
    except:
        print("Unexpected error:", sys.exc_info()[0])

else:
    print("coreversion is None!")

#调用tomcat
os.system('python3 bushu.py')